<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="facade.Facade"%>

<html>
<body>
       <!-- Feito por Rafael de Brito -->
       <form action= "cadastrar.jsp" method="post" accept-charset="UTF-8">
        Nome:_____<input name = "nome"/></br>
        Login:____<input name = "login"/></br>
        Senha:____<input name = "senha"/></br>
        CPF:______<input name = "cpf"/></br>
        Matricula:<input name = "matricula"/></br>
        Telefone:_<input name = "telefone"/></br>
        Setor:____<input name = "setor"></br>
        Categoria:<input name = "categora"></br>
        <input value="Finalizar cadastro" type = "submit">
		        </form>
		
		<%
		String nome = request.getParameter("nome");
		String login = request.getParameter("login");
		String senha = request.getParameter("senha");
		String cpf = request.getParameter("cpf");
		String matricula = request.getParameter("matricula");
		String telefone = request.getParameter("telefone");
		String setor = request.getParameter("setor");
		String cat = request.getParameter("categoria");
		
		Facade facade = new Facade();
		try{
		facade.iniciar();
		facade.criarUsuario(login, senha, matricula, cpf, nome, telefone, setor, cat);
		facade.close();
		}
		catch(Exception e){
		e.printStackTrace();
		}
		 
		out.println("<script>document.location.href='cadastrocriado.jsp';</script>"); 
		  
		%>
	
</body>	
</html>